package com.ljt.yupictureddd.application.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ljt.yupictureddd.infrastracture.common.BaseResponse;
import com.ljt.yupictureddd.infrastracture.common.DeleteRequest;
import com.ljt.yupictureddd.interfaces.dto.user.UserAddRequest;
import com.ljt.yupictureddd.interfaces.dto.user.UserQueryRequest;
import com.ljt.yupictureddd.interfaces.dto.user.UserRegisterRequest;
import com.ljt.yupictureddd.domain.user.entity.User;
import com.ljt.yupictureddd.interfaces.dto.user.UserUpdateRequest;
import com.ljt.yupictureddd.interfaces.vo.user.LoginUserVO;
import com.ljt.yupictureddd.interfaces.vo.user.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.List;

/**
* @author 六件套
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-03-05 19:37:54
*/
public interface UserApplicationService {
    /**
     * 用户注册
     * @param request
     * @return
     */
    long userRegister(UserRegisterRequest request);

    /**
     * 用户登陆
     *
     * @param userAccount
     * @param userPassword
     * @param request
     * @return 脱敏后的用户信息
     */
    LoginUserVO userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 获取当前User
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);



    /**
     * 用户退出登陆
     *
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 获得MybatisPlus查询对象
     * @param request
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest request);

    /**
     * 密码加密
     *
     * @param userPassword 注册登陆的提交的密码
     * @return 加密后的密码
     */
    String getEncryptedPassword(String userPassword);

    LoginUserVO getLoginUserVO(User user);

    /**
     * 转换用户脱敏后的用户VO
     * @param user
     * @return
     */
    UserVO getUserVO(User user);

    /**
     * 转换用户脱敏后的用户VO
     * @param user
     * @return
     */
    public List<UserVO> getUserVOList(List<User> user);

    /**
     * 新增用户
     */
    BaseResponse addUser(UserAddRequest userAddRequest);

    /**
     * 根据 id 获取用户（仅管理员）
     */
    BaseResponse<User> getUserById(long id);

    /**
     * 删除用户
     */
    BaseResponse<Boolean> deleteUser(DeleteRequest deleteRequest);

    /**
     * 更新用户
     */
    BaseResponse<Boolean> updateUser(UserUpdateRequest userUpdateRequest);

    /**
     * 分页
     */
    BaseResponse listUserVOByPage(UserQueryRequest userQueryRequest);

    User getById(Long userId);

    List<User> listByIds(Collection<Long> userIdSet);
}
